Skip to content

Conversation

GabLeRoux
Copy link

@GabLeRoux GabLeRoux commented Jan 24, 2018

👋 Hey there,
I tried to use this library, your fork doesn't allow writing issue, I think your fork is more up to date and maintained so I didn't create an issue upstream. Anyway, here's a pr that brings travis-ci testing for multiple python versions. It will run both offline and live tests and I made sure credentials are encrypted (confirmed working).

I tried to run the tests, but they're all failing with the same error message:

ERROR: test_api_client_instance_created (tests.tests_live.TogglClientApiLiveTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/GabLeRoux/toggl-python-api-client/tests/tests_live.py", line 16, in setUp
    self.api = TogglClientApi(self.settings)
  File "/home/travis/build/GabLeRoux/toggl-python-api-client/toggl/api_client.py", line 30, in __init__
    self.user_agent = self.credentials['user_agent']
KeyError: 'user_agent'

So there's probably something wrong. I did not look at the tests yet, I can't tell right now if it's something that changed recently that broke the tests or if the tests are just broken.

You can find the full output here:
https://travis-ci.org/GabLeRoux/toggl-python-api-client/builds/332608834

btw: I know there are many commits, took me a few attempts until I manage to get this working in travis, I can create a new pr and squash everything into one commit if you prefer ;)

Instructions for travis encrytped env variables

documentation

gem install travis
travis encrypt \
WORKSPACE_NAME=example-workspace \
TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
WORKSPACE_ID=yyyyyyy \
USER_ID=zzzzzzz \
--add env.matrix

@GabLeRoux
Copy link
Author

GabLeRoux commented Jan 24, 2018

I've specified a default user_agent (python), and now a few tests pass.

https://travis-ci.org/GabLeRoux/toggl-python-api-client/builds/332614236

On python2.7 Most of the tests fail with workspace_id:

Traceback (most recent call last):
  File "/home/travis/build/GabLeRoux/toggl-python-api-client/tests/tests_offline.py", line 25, in setUp
    self.api = TogglClientApi(self.settings)
  File "/home/travis/build/GabLeRoux/toggl-python-api-client/toggl/api_client.py", line 32, in __init__
    self.workspace_id = int(self.credentials['workspace_id'])
KeyError: 'workspace_id'

and there's one test failing with this:

FAIL: test_api_toggl_get_member_total_hours_range_response_ok (tests.tests_live.TogglClientApiLiveTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/GabLeRoux/toggl-python-api-client/tests/tests_live.py", line 58, in test_api_toggl_get_member_total_hours_range_response_ok
    self.assertGreater(total, 0)
AssertionError: 0 not greater than 0

The tests seem to fail on 3.3 and above, all tests are failing with this:

Traceback (most recent call last):
  File "/home/travis/build/GabLeRoux/toggl-python-api-client/tests/tests_live.py", line 16, in setUp
    self.api = TogglClientApi(self.settings)
  File "/home/travis/build/GabLeRoux/toggl-python-api-client/toggl/api_client.py", line 25, in __init__
    self.credentials = dict(self.defaultCredentials.items() + credentials.items())
TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant